package com.gonsin.gmessage.logic.websocket;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

@ApiModel("WebSocket 连接信息")
@Data
public class SessionInfo {

    @ApiModelProperty("连接id")
    private String sessionId;

    @ApiModelProperty("连接时间")
    private Date connectTime;

    @ApiModelProperty("已经注册的指令")
    private Set<ZoomCmd> registeredCmd = new HashSet<>();      // 已经注册的指令

    @ApiModelProperty("用户名")
    private String username;      // 用户名

    @ApiModelProperty("远端的ip地址")
    private String remoteAddress;

    @ApiModelProperty("发生异常的次数")
    private int exceptionCount;     // 发生异常的次数

    @ApiModelProperty("上一次发生异常的异常信息")
    private String lastException;

    /**
     *
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    static
    class ZoomCmd{

         private String zoom;

         private String cmd;
    }

}
